﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BiliBiliCSharpStudy.clazz.access2 {
    class HelloAccess2 {
        public static void Demo() {
            Test1();
        }

        public static void Test1() {
            Car car = new Car();
            car.Accelerate();
            car.Accelerate();
            Console.WriteLine(car.Speed);
        }
    }

    public class Vehicle {
        private int _rpm;
        public void Accelerate() {
            _rpm += 1000;
        }

        public int Speed {
            get {
                return _rpm / 100;
            }
        }
    }

    public class Car : Vehicle { }
}
